package cn.wjee.gradle.flink;


import cn.wjee.gradle.flink.config.FlinkExtConfig;
import cn.wjee.gradle.flink.task.PublishFlinkTask;
import org.gradle.api.Plugin;
import org.gradle.api.Project;

/**
 * The Plugin Publish Flink Job
 *
 * @author listening
 */
public class PublishFlinkPlugin implements Plugin<Project> {
    @Override
    public void apply(Project project) {
        project.getExtensions().create("flink", FlinkExtConfig.class);

        project.afterEvaluate(pj -> {
            FlinkExtConfig config = pj.getExtensions().getByType(FlinkExtConfig.class);
            pj.getTasks().create("publishFlink", PublishFlinkTask.class, config);
        });
    }

}
